package com.itheima.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;


@Controller
public class CPU {
    @RequestMapping("/input")
    public String input() {
        System.out.println("跳转至input.jsp");
       return "input";
    }
    @RequestMapping("/getYear")
    public ModelAndView getYear(HttpServletRequest request) {
        int inputmsg= Integer.parseInt(request.getParameter("year"));
        int outputmsg=inputmsg+1000;
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("output");
        modelAndView.addObject("inputmsg",inputmsg);
        modelAndView.addObject("outputmsg",outputmsg);
        System.out.println(modelAndView);
        return modelAndView;
    }
}
